import { ColumnGroupType, ColumnType } from "antd/es/table"

import { chatContentTypeArr } from "@/utils/const"
import { formatTime, getTypeName } from "@/utils/util"

const chatRecord = (newFormat: (arg: string) => string): Record<string, ColumnGroupType<any> | ColumnType<any>> => ({
	chatRecord_userId: {
		key: "chatRecord_userId",
		align: "center",
		dataIndex: "userId",
		title: newFormat("dxn.card_ables_list.player_id"),
		width: 160,
		render: (userId: string) => <span style={{ color: "#aaaaaa" }}>{userId}</span>
	},
	chatRecord_nickName: {
		key: "chatRecord_nickName",
		align: "center",
		dataIndex: "nickName",
		title: newFormat("dxn.card_ables_list.nick_name"),
		width: 160
	},
	chatRecord_chatContentType: {
		key: "chatRecord_chatContentType",
		align: "center",
		dataIndex: "chatContentType",
		title: newFormat("dxn.card_ables_list.chat_type"),
		width: 160,
		render: (chatContentType: number) => getTypeName(chatContentType, chatContentTypeArr)
	},
	chatRecord_content: {
		key: "chatRecord_content",
		align: "center",
		dataIndex: "content",
		title: newFormat("dxn.card_ables_list.chat_content"),
		width: 400
	},
	chatRecord_sendTime: {
		key: "chatRecord_sendTime",
		align: "center",
		dataIndex: "sendTime",
		title: newFormat("dxn.card_ables_list.send_time"),
		width: 160,
		render: (sendTime: string) => formatTime(sendTime)
	}
})
export default chatRecord
